package com.ttnet.model.enumerations;

import org.apache.log4j.Logger;

public enum Role {
	ROOT, ADMINISTRATOR, ORDINARY;

	private static final Logger LOG = Logger.getLogger(Role.class);

	private Role() {
	}

	public static Role get(int ordinal) {
		Role[] values = Role.values();
		for (Role role : values) {
			if (role.ordinal() == ordinal) {
				return role;
			}
		}

		LOG.warn("Enum not found: ordinal=" + ordinal);

		return null;
	}

	public String getName() {
		return name();
	}
}
